<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
	</head>
	<body>
		<button type="button" onclick="GetObtain1();">GET获取1获取当前日期和时间</button>
		<div id="tap1">
		</div>
		<button type="button" onclick="GetObtain2();">GET获取2随机一句名言</button>
		<div id="tap2">
		</div>
		<button type="button" onclick="GetObtain3();">GET获取3获取诗词列表-包含作者信息</button>
		<div id="tap3">
		</div>
		<button type="button" onclick="GetObtain4();">GET获取4获取诗词作者列表</button>
		<div id="tap4">
		</div>
		<button type="button" onclick="GetObtain5();">GET获取5获取诗词列表</button>
		<div id="tap5">
		</div>
	</body>
	<script type="text/javascript">
		var GetObj=new XMLHttpRequest();
		var obj;
		function GetObtain1(){
			GetObj.open('GET','http://poetry.apiopen.top/getTime');
			GetObj.send();
			GetObj.onreadystatechange=function(){
				if(GetObj.status==200&GetObj.readyState==4){
					obj=JSON.parse(GetObj.responseText);
					document.getElementById('tap1').innerHTML=obj.result.date+'<br>'+obj.result.dateTime+'<br>'
					+obj.result.time+'<br>'+obj.result.weekday;
					console.log(obj);
				}
			}
		}
		function GetObtain2(){
			GetObj.open('GET','http://poetry.apiopen.top/sentences');
			GetObj.send();
			GetObj.onreadystatechange=function(){
				if(GetObj.status==200&GetObj.readyState==4){
					obj=JSON.parse(GetObj.responseText);
					document.getElementById('tap2').innerHTML=obj.result.from+'<br>'+obj.result.name;
					console.log(obj.result);
				}
			}
		}
		function GetObtain3(){
			GetObj.open('GET','http://poetry.apiopen.top/poetryFull?count=2&page=1');
			GetObj.send();
			GetObj.onreadystatechange=function(){
				if(GetObj.status==200&GetObj.readyState==4){
					obj=JSON.parse(GetObj.responseText);
					var str='';
					for(var i=0;i<obj.result.length;i++){
					str=str+obj.result[i].title+'<br>'+obj.result[i].dynasty
					  +'<br>'+obj.result[i].writer+'<br>'+obj.result[i].content
					  +'<br>'+obj.result[i].type+'<br>'+obj.result[i].remark+'<br>'+obj.result[i].appreciatio
					  +'<br>'+obj.result[i].translation+'<br>'+obj.result[i].simpleIntro+'<br>'+obj.result[i].detailIntro+'<br>';
					  }
					document.getElementById('tap3').innerHTML=str;
					console.log(obj);
				}
			}
			}
		function GetObtain4(){
			GetObj.open('GET','http://poetry.apiopen.top/poetryAuthor?count=2&page=1&name=李白');
			GetObj.send();
			GetObj.onreadystatechange=function(){
				if(GetObj.status==200&GetObj.readyState==4){
					obj=JSON.parse(GetObj.responseText);
					document.getElementById('tap4').innerHTML=
					obj.result.name+'<br>'+obj.result.simpleIntro+'<br>'+obj.result.detailIntro+'<br>';
					console.log(obj);
				}
			}
			}
		function GetObtain5(){
			GetObj.open('GET','http://poetry.apiopen.top/poetry?count=2&page=1');
			GetObj.send();
			GetObj.onreadystatechange=function(){
				if(GetObj.status==200&GetObj.readyState==4){
					obj=JSON.parse(GetObj.responseText);
					var str='';
					for(var i=0;i<obj.result.length;i++){
					str=str+obj.result[i].title+'<br>'+obj.result[i].dynasty
					  +'<br>'+obj.result[i].writer+'<br>'+obj.result[i].content
					  +'<br>'+obj.result[i].type+'<br>'+obj.result[i].remark
					  +'<br>'+obj.result[i].appreciatio+'<br>'+obj.result[i].translation+'<br>';
					  }
					document.getElementById('tap5').innerHTML=str;
					console.log(obj);
				}
			}
			}
			
	
	
	</script>
</html>
